package com.netease.web.dao;



import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.netease.web.pojo.Content;

@Repository
public interface ContentDao {

	@Select("select * from content where id=#{id}")
	public Content getContentById(int id);
	
	@Select("select * from content")
	public List<Content> getAllContent();
	
	@Delete("delete * from content where id=#{id}")
	public int deleteContentById(int id);
	
	@Insert("insert into content values(price=#{price},title=#{title},icon=#{image},absract=#{summary},text=#{detail})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertContent(Content content);
	
	@Update("update content set price=#{price},title=#{title},icon=#{image},abstract=#{summary},text=#{details} where id = #{id}")
	public int updataContent(Content content);
}
